package com.zhang.entity;

import com.baomidou.mybatisplus.annotation.IdType;

import java.util.ArrayList;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 *
 * </p>
 *
 * @author 张立松
 * @since 2022-12-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysMenu extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotNull(message = "上级菜单不能为空")  //spring-boot-starter-validation工具包的注解
    private Long parentId;

    @NotBlank(message = "菜单名字不能为空") //spring-boot-starter-validation工具包的注解
    private String name;

    private String path;

    @NotBlank(message = "菜单权限不能为空")
    private String perm;

    private String component;

    @NotNull(message = "菜单类型不能为空")
    private Integer type;

    private String icon;

    @TableField("orderNum")
    private Integer orderNum;

    private Integer status;

    @TableField(exist = false)  //声明数据库中没有此参数
    private List<SysMenu> children = new ArrayList<>();
}
